/*
 Navicat Premium Data Transfer

 Source Server         : LocalDB
 Source Server Type    : SQL Server
 Source Server Version : 15004153
 Source Host           : (localdb)\MSSQLLocalDB:1433
 Source Catalog        : OcelotSettings
 Source Schema         : dbo

 Target Server Type    : SQL Server
 Target Server Version : 15004153
 File Encoding         : 65001

 Date: 07/07/2023 17:28:20
*/


-- ----------------------------
-- Table structure for Dictionary
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[Dictionary]') AND type IN ('U'))
	DROP TABLE [dbo].[Dictionary]
GO

CREATE TABLE [dbo].[Dictionary] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [DictionaryName] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [DictionaryType] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[Dictionary] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键Id',
'SCHEMA', N'dbo',
'TABLE', N'Dictionary',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典名',
'SCHEMA', N'dbo',
'TABLE', N'Dictionary',
'COLUMN', N'DictionaryName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典类型',
'SCHEMA', N'dbo',
'TABLE', N'Dictionary',
'COLUMN', N'DictionaryType'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典表',
'SCHEMA', N'dbo',
'TABLE', N'Dictionary'
GO


-- ----------------------------
-- Records of Dictionary
-- ----------------------------
SET IDENTITY_INSERT [dbo].[Dictionary] ON
GO

SET IDENTITY_INSERT [dbo].[Dictionary] OFF
GO


-- ----------------------------
-- Table structure for DictionaryItem
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[DictionaryItem]') AND type IN ('U'))
	DROP TABLE [dbo].[DictionaryItem]
GO

CREATE TABLE [dbo].[DictionaryItem] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [DictionaryId] int  NOT NULL,
  [Key] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Value] varchar(50) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Remark] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [Enabled] bit  NOT NULL
)
GO

ALTER TABLE [dbo].[DictionaryItem] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键Id',
'SCHEMA', N'dbo',
'TABLE', N'DictionaryItem',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典Id',
'SCHEMA', N'dbo',
'TABLE', N'DictionaryItem',
'COLUMN', N'DictionaryId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'关键字',
'SCHEMA', N'dbo',
'TABLE', N'DictionaryItem',
'COLUMN', N'Key'
GO

EXEC sp_addextendedproperty
'MS_Description', N'值',
'SCHEMA', N'dbo',
'TABLE', N'DictionaryItem',
'COLUMN', N'Value'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'DictionaryItem',
'COLUMN', N'Remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用',
'SCHEMA', N'dbo',
'TABLE', N'DictionaryItem',
'COLUMN', N'Enabled'
GO

EXEC sp_addextendedproperty
'MS_Description', N'字典项表',
'SCHEMA', N'dbo',
'TABLE', N'DictionaryItem'
GO


-- ----------------------------
-- Records of DictionaryItem
-- ----------------------------
SET IDENTITY_INSERT [dbo].[DictionaryItem] ON
GO

SET IDENTITY_INSERT [dbo].[DictionaryItem] OFF
GO


-- ----------------------------
-- Table structure for GlobalConfiguration
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[GlobalConfiguration]') AND type IN ('U'))
	DROP TABLE [dbo].[GlobalConfiguration]
GO

CREATE TABLE [dbo].[GlobalConfiguration] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [BaseUrl] nvarchar(300) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [RequestIdKey] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [DownstreamScheme] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DownstreamHttpVersion] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LoadBalancer_Type] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LoadBalancer_Key] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LoadBalancer_Expiry] int  NULL,
  [HttpHandler_AllowAutoRedirect] bit  NULL,
  [HttpHandler_UseCookieContainer] bit  NULL,
  [HttpHandler_UseTracing] bit  NULL,
  [HttpHandler_UseProxy] bit  NULL,
  [HttpHandler_MaxConnectionsPerServer] int  NULL,
  [QosEnabled] bit  NULL,
  [Qos_ExceptionsAllowedBeforeBreaking] int  NULL,
  [Qos_DurationOfBreak] int  NULL,
  [Qos_TimeoutValue] int  NULL,
  [RateLimit_ClientIdHeader] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [RateLimit_QuotaExceededMessage] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [RateLimit_RateLimitCounterPrefix] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [RateLimit_DisableRateLimitHeaders] bit  NULL,
  [RateLimit_HttpStatusCode] int  NULL,
  [ServiceDiscovery_Scheme] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceDiscovery_Host] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceDiscovery_Port] int  NULL,
  [ServiceDiscovery_Type] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceDiscovery_Token] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceDiscovery_ConfigurationKey] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceDiscovery_PollingInterval] int  NULL,
  [ServiceDiscovery_Namespace] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceDiscoveryEnabled] bit  NULL,
  [Enabled] bit DEFAULT 0 NOT NULL
)
GO

ALTER TABLE [dbo].[GlobalConfiguration] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键Id',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'基础地址',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'BaseUrl'
GO

EXEC sp_addextendedproperty
'MS_Description', N'请求ID',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'RequestIdKey'
GO

EXEC sp_addextendedproperty
'MS_Description', N'Http协议（http,https）',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'DownstreamScheme'
GO

EXEC sp_addextendedproperty
'MS_Description', N'Http版本（1.0，1.1，2.0）',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'DownstreamHttpVersion'
GO

EXEC sp_addextendedproperty
'MS_Description', N'负载均衡方式（LeastConnection，RoundRobin，NoLoadBalance）',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'LoadBalancer_Type'
GO

EXEC sp_addextendedproperty
'MS_Description', N'负载均衡关键字',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'LoadBalancer_Key'
GO

EXEC sp_addextendedproperty
'MS_Description', N'负载均衡结束时间（ms）',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'LoadBalancer_Expiry'
GO

EXEC sp_addextendedproperty
'MS_Description', N'允许自定重定向',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'HttpHandler_AllowAutoRedirect'
GO

EXEC sp_addextendedproperty
'MS_Description', N'使用Cookie容器',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'HttpHandler_UseCookieContainer'
GO

EXEC sp_addextendedproperty
'MS_Description', N'使用追踪',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'HttpHandler_UseTracing'
GO

EXEC sp_addextendedproperty
'MS_Description', N'使用代理',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'HttpHandler_UseProxy'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'HttpHandler_MaxConnectionsPerServer'
GO

EXEC sp_addextendedproperty
'MS_Description', N'流量调控开启',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'QosEnabled'
GO

EXEC sp_addextendedproperty
'MS_Description', N'打开断路器之前允许的例外数量',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'Qos_ExceptionsAllowedBeforeBreaking'
GO

EXEC sp_addextendedproperty
'MS_Description', N'断路器复位之前打开的时间（ms）',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'Qos_DurationOfBreak'
GO

EXEC sp_addextendedproperty
'MS_Description', N'请求超时时间（ms）',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'Qos_TimeoutValue'
GO

EXEC sp_addextendedproperty
'MS_Description', N'客户Header',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'RateLimit_ClientIdHeader'
GO

EXEC sp_addextendedproperty
'MS_Description', N'超过限制提示语',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'RateLimit_QuotaExceededMessage'
GO

EXEC sp_addextendedproperty
'MS_Description', N'计数前缀',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'RateLimit_RateLimitCounterPrefix'
GO

EXEC sp_addextendedproperty
'MS_Description', N'包含X-Rate-Limit和Rety-After',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'RateLimit_DisableRateLimitHeaders'
GO

EXEC sp_addextendedproperty
'MS_Description', N'超过限制Http状态码',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'RateLimit_HttpStatusCode'
GO

EXEC sp_addextendedproperty
'MS_Description', N'Http协议（http,https）',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_Scheme'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_Host'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_Port'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_Type'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_Token'
GO

EXEC sp_addextendedproperty
'MS_Description', N'配置key',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_ConfigurationKey'
GO

EXEC sp_addextendedproperty
'MS_Description', N'轮询间隔',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_PollingInterval'
GO

EXEC sp_addextendedproperty
'MS_Description', N'命名空间',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscovery_Namespace'
GO

EXEC sp_addextendedproperty
'MS_Description', N'服务发现开启',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'ServiceDiscoveryEnabled'
GO

EXEC sp_addextendedproperty
'MS_Description', N'配置启动',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration',
'COLUMN', N'Enabled'
GO

EXEC sp_addextendedproperty
'MS_Description', N'全局配置表',
'SCHEMA', N'dbo',
'TABLE', N'GlobalConfiguration'
GO


-- ----------------------------
-- Records of GlobalConfiguration
-- ----------------------------
SET IDENTITY_INSERT [dbo].[GlobalConfiguration] ON
GO

SET IDENTITY_INSERT [dbo].[GlobalConfiguration] OFF
GO


-- ----------------------------
-- Table structure for Project
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[Project]') AND type IN ('U'))
	DROP TABLE [dbo].[Project]
GO

CREATE TABLE [dbo].[Project] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [ProjectName] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [OrderIndex] int  NOT NULL,
  [Enabled] bit  NOT NULL,
  [CreateTime] bigint  NOT NULL,
  [UpdateTime] bigint  NOT NULL
)
GO

ALTER TABLE [dbo].[Project] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键Id',
'SCHEMA', N'dbo',
'TABLE', N'Project',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'项目名称',
'SCHEMA', N'dbo',
'TABLE', N'Project',
'COLUMN', N'ProjectName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'排序字段',
'SCHEMA', N'dbo',
'TABLE', N'Project',
'COLUMN', N'OrderIndex'
GO

EXEC sp_addextendedproperty
'MS_Description', N'启用',
'SCHEMA', N'dbo',
'TABLE', N'Project',
'COLUMN', N'Enabled'
GO

EXEC sp_addextendedproperty
'MS_Description', N'创建时间',
'SCHEMA', N'dbo',
'TABLE', N'Project',
'COLUMN', N'CreateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'编辑时间',
'SCHEMA', N'dbo',
'TABLE', N'Project',
'COLUMN', N'UpdateTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'项目表',
'SCHEMA', N'dbo',
'TABLE', N'Project'
GO


-- ----------------------------
-- Records of Project
-- ----------------------------
SET IDENTITY_INSERT [dbo].[Project] ON
GO

SET IDENTITY_INSERT [dbo].[Project] OFF
GO


-- ----------------------------
-- Table structure for Route
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[Route]') AND type IN ('U'))
	DROP TABLE [dbo].[Route]
GO

CREATE TABLE [dbo].[Route] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [ProjectId] int  NOT NULL,
  [DownstreamPathTemplate] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [UpstreamPathTemplate] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [UpstreamHttpMethod] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [DownstreamHttpMethod] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DownstreamHttpVersion] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [RequestIdKey] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [RouteIsCaseSensitive] bit  NULL,
  [ServiceName] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [ServiceNamespace] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NULL,
  [DownstreamScheme] nvarchar(20) COLLATE Chinese_PRC_CI_AS  NULL,
  [Cache_TtlSeconds] int  NULL,
  [Cache_Region] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Qos_ExceptionsAllowedBeforeBreaking] int  NULL,
  [Qos_DurationOfBreak] int  NULL,
  [Qos_TimeoutValue] int  NULL,
  [LoadBalancer_Type] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LoadBalancer_Key] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [LoadBalancer_Expiry] int  NULL,
  [RateLimit_EnableRateLimiting] bit  NULL,
  [RateLimit_Period] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [RateLimit_PeriodTimespan] decimal(38)  NULL,
  [RateLimit_Limit] bigint  NULL,
  [RateLimit_WhiteList] nvarchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [Authentication_AuthenticationProviderKey] nvarchar(200) COLLATE Chinese_PRC_CI_AS  NULL,
  [Authentication_AllowedScopes] nvarchar(300) COLLATE Chinese_PRC_CI_AS  NULL,
  [HttpHandler_AllowAutoRedirect] bit  NULL,
  [HttpHandler_UseCookieContainer] bit  NULL,
  [HttpHandler_UseTracing] bit  NULL,
  [HttpHandler_UseProxy] bit  NULL,
  [HttpHandler_MaxConnectionsPerServer] int  NULL,
  [UpstreamHost] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [Key] nvarchar(50) COLLATE Chinese_PRC_CI_AS  NULL,
  [DelegatingHandlers] nvarchar(300) COLLATE Chinese_PRC_CI_AS  NULL,
  [Priority] int  NULL,
  [Timeout] int  NULL,
  [DangerousAcceptAnyServerCertificateValidator] bit  NULL,
  [Security_IPAllowedList] nvarchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [Security_IPBlockedList] nvarchar(500) COLLATE Chinese_PRC_CI_AS  NULL,
  [Enabled] bit  NOT NULL,
  [Sort] int DEFAULT 0 NULL
)
GO

ALTER TABLE [dbo].[Route] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键ID',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'项目Id',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'ProjectId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'下游的路由模板，即真实处理请求的路径模板',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'DownstreamPathTemplate'
GO

EXEC sp_addextendedproperty
'MS_Description', N'上游请求的模板，即用户真实请求的链接',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'UpstreamPathTemplate'
GO

EXEC sp_addextendedproperty
'MS_Description', N'上游请求的http方法（数组：GET、POST、PUT）',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'UpstreamHttpMethod'
GO

EXEC sp_addextendedproperty
'MS_Description', N'下游请求的http方法（数组：GET、POST、PUT）',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'DownstreamHttpMethod'
GO

EXEC sp_addextendedproperty
'MS_Description', N'下游Http版本',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'DownstreamHttpVersion'
GO

EXEC sp_addextendedproperty
'MS_Description', N'请求Id',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'RequestIdKey'
GO

EXEC sp_addextendedproperty
'MS_Description', N'开启上下游路由模板大小写匹配',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'RouteIsCaseSensitive'
GO

EXEC sp_addextendedproperty
'MS_Description', N'服务发现名称',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'ServiceName'
GO

EXEC sp_addextendedproperty
'MS_Description', N'服务发现命名空间',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'ServiceNamespace'
GO

EXEC sp_addextendedproperty
'MS_Description', N'请求的方式，如：http,htttps',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'DownstreamScheme'
GO

EXEC sp_addextendedproperty
'MS_Description', N'请求缓存过期时间（需使用Ocelot.Cache.CacheManager）',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Cache_TtlSeconds'
GO

EXEC sp_addextendedproperty
'MS_Description', N'缓存区域（需使用Ocelot.Cache.CacheManager）',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Cache_Region'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Qos_ExceptionsAllowedBeforeBreaking'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Qos_DurationOfBreak'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Qos_TimeoutValue'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'LoadBalancer_Type'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'LoadBalancer_Key'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'LoadBalancer_Expiry'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启用流量限制',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'RateLimit_EnableRateLimiting'
GO

EXEC sp_addextendedproperty
'MS_Description', N'限流周期（如：1s、1m、1h）',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'RateLimit_Period'
GO

EXEC sp_addextendedproperty
'MS_Description', N'恢复等待时间',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'RateLimit_PeriodTimespan'
GO

EXEC sp_addextendedproperty
'MS_Description', N'时间周期内允许访问的最大次数',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'RateLimit_Limit'
GO

EXEC sp_addextendedproperty
'MS_Description', N'限流白名单',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'RateLimit_WhiteList'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Authentication_AuthenticationProviderKey'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Authentication_AllowedScopes'
GO

EXEC sp_addextendedproperty
'MS_Description', N'允许自动跳转',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'HttpHandler_AllowAutoRedirect'
GO

EXEC sp_addextendedproperty
'MS_Description', N'使用Cookie容器',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'HttpHandler_UseCookieContainer'
GO

EXEC sp_addextendedproperty
'MS_Description', N'使用链路追踪',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'HttpHandler_UseTracing'
GO

EXEC sp_addextendedproperty
'MS_Description', N'使用代理',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'HttpHandler_UseProxy'
GO

EXEC sp_addextendedproperty
'MS_Description', N'服务最大连接数 ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'HttpHandler_MaxConnectionsPerServer'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'UpstreamHost'
GO

EXEC sp_addextendedproperty
'MS_Description', N'委托处理',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'DelegatingHandlers'
GO

EXEC sp_addextendedproperty
'MS_Description', N'路由节点优先级',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Priority'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Timeout'
GO

EXEC sp_addextendedproperty
'MS_Description', N'评估危险服务器认证',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'DangerousAcceptAnyServerCertificateValidator'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Security_IPAllowedList'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Security_IPBlockedList'
GO

EXEC sp_addextendedproperty
'MS_Description', N' ',
'SCHEMA', N'dbo',
'TABLE', N'Route',
'COLUMN', N'Enabled'
GO

EXEC sp_addextendedproperty
'MS_Description', N'路由主表',
'SCHEMA', N'dbo',
'TABLE', N'Route'
GO


-- ----------------------------
-- Records of Route
-- ----------------------------
SET IDENTITY_INSERT [dbo].[Route] ON
GO

SET IDENTITY_INSERT [dbo].[Route] OFF
GO


-- ----------------------------
-- Table structure for RouteHostPort
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[RouteHostPort]') AND type IN ('U'))
	DROP TABLE [dbo].[RouteHostPort]
GO

CREATE TABLE [dbo].[RouteHostPort] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [Host] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Port] int  NOT NULL,
  [RouteId] int  NOT NULL
)
GO

ALTER TABLE [dbo].[RouteHostPort] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键Id',
'SCHEMA', N'dbo',
'TABLE', N'RouteHostPort',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'路由Id',
'SCHEMA', N'dbo',
'TABLE', N'RouteHostPort',
'COLUMN', N'RouteId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'路由地址配置表',
'SCHEMA', N'dbo',
'TABLE', N'RouteHostPort'
GO


-- ----------------------------
-- Records of RouteHostPort
-- ----------------------------
SET IDENTITY_INSERT [dbo].[RouteHostPort] ON
GO

SET IDENTITY_INSERT [dbo].[RouteHostPort] OFF
GO


-- ----------------------------
-- Table structure for RouteProperty
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[RouteProperty]') AND type IN ('U'))
	DROP TABLE [dbo].[RouteProperty]
GO

CREATE TABLE [dbo].[RouteProperty] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [Key] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Value] nvarchar(100) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [RouteId] int  NOT NULL,
  [Type] int  NOT NULL
)
GO

ALTER TABLE [dbo].[RouteProperty] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键Id',
'SCHEMA', N'dbo',
'TABLE', N'RouteProperty',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'路由Id',
'SCHEMA', N'dbo',
'TABLE', N'RouteProperty',
'COLUMN', N'RouteId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'路由属性表',
'SCHEMA', N'dbo',
'TABLE', N'RouteProperty'
GO


-- ----------------------------
-- Records of RouteProperty
-- ----------------------------
SET IDENTITY_INSERT [dbo].[RouteProperty] ON
GO

SET IDENTITY_INSERT [dbo].[RouteProperty] OFF
GO


-- ----------------------------
-- Table structure for SettingBak
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[SettingBak]') AND type IN ('U'))
	DROP TABLE [dbo].[SettingBak]
GO

CREATE TABLE [dbo].[SettingBak] (
  [Id] int  IDENTITY(1,1) NOT NULL,
  [BakTime] datetime  NOT NULL,
  [BakJson] varchar(max) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [Remark] varchar(255) COLLATE Chinese_PRC_CI_AS  NULL,
  [ConsulKey] varchar(255) COLLATE Chinese_PRC_CI_AS  NOT NULL,
  [ConsulDc] varchar(20) COLLATE Chinese_PRC_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[SettingBak] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键Id',
'SCHEMA', N'dbo',
'TABLE', N'SettingBak',
'COLUMN', N'Id'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备份时间',
'SCHEMA', N'dbo',
'TABLE', N'SettingBak',
'COLUMN', N'BakTime'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备份内容',
'SCHEMA', N'dbo',
'TABLE', N'SettingBak',
'COLUMN', N'BakJson'
GO

EXEC sp_addextendedproperty
'MS_Description', N'备注',
'SCHEMA', N'dbo',
'TABLE', N'SettingBak',
'COLUMN', N'Remark'
GO

EXEC sp_addextendedproperty
'MS_Description', N'配置备份表',
'SCHEMA', N'dbo',
'TABLE', N'SettingBak'
GO


-- ----------------------------
-- Records of SettingBak
-- ----------------------------
SET IDENTITY_INSERT [dbo].[SettingBak] ON
GO

SET IDENTITY_INSERT [dbo].[SettingBak] OFF
GO


-- ----------------------------
-- Table structure for UserAccount
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[UserAccount]') AND type IN ('U'))
	DROP TABLE [dbo].[UserAccount]
GO

CREATE TABLE [dbo].[UserAccount] (
  [ID] bigint  NOT NULL,
  [Account] varchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS  NOT NULL,
  [Password] varchar(20) COLLATE SQL_Latin1_General_CP1_CI_AS  NOT NULL,
  [OpenId] varchar(38) COLLATE SQL_Latin1_General_CP1_CI_AS  NULL,
  [Enabled] bit  NOT NULL,
  [Name] nvarchar(10) COLLATE SQL_Latin1_General_CP1_CI_AS  NOT NULL
)
GO

ALTER TABLE [dbo].[UserAccount] SET (LOCK_ESCALATION = TABLE)
GO

EXEC sp_addextendedproperty
'MS_Description', N'主键ID',
'SCHEMA', N'dbo',
'TABLE', N'UserAccount',
'COLUMN', N'ID'
GO

EXEC sp_addextendedproperty
'MS_Description', N'账户',
'SCHEMA', N'dbo',
'TABLE', N'UserAccount',
'COLUMN', N'Account'
GO

EXEC sp_addextendedproperty
'MS_Description', N'密码',
'SCHEMA', N'dbo',
'TABLE', N'UserAccount',
'COLUMN', N'Password'
GO

EXEC sp_addextendedproperty
'MS_Description', N'OpenId',
'SCHEMA', N'dbo',
'TABLE', N'UserAccount',
'COLUMN', N'OpenId'
GO

EXEC sp_addextendedproperty
'MS_Description', N'是否启动',
'SCHEMA', N'dbo',
'TABLE', N'UserAccount',
'COLUMN', N'Enabled'
GO

EXEC sp_addextendedproperty
'MS_Description', N'姓名',
'SCHEMA', N'dbo',
'TABLE', N'UserAccount',
'COLUMN', N'Name'
GO

EXEC sp_addextendedproperty
'MS_Description', N'用户表',
'SCHEMA', N'dbo',
'TABLE', N'UserAccount'
GO


-- ----------------------------
-- Records of UserAccount
-- ----------------------------
INSERT INTO [dbo].[UserAccount] ([ID], [Account], [Password], [OpenId], [Enabled], [Name]) VALUES (N'12', N'admin', N'123456', N'', N'1', N'admin')
GO


-- ----------------------------
-- Auto increment value for Dictionary
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[Dictionary]', RESEED, 6)
GO


-- ----------------------------
-- Primary Key structure for table Dictionary
-- ----------------------------
ALTER TABLE [dbo].[Dictionary] ADD CONSTRAINT [PK__Dictiona__3214EC0785134EC7] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for DictionaryItem
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[DictionaryItem]', RESEED, 1)
GO


-- ----------------------------
-- Auto increment value for GlobalConfiguration
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[GlobalConfiguration]', RESEED, 138)
GO


-- ----------------------------
-- Primary Key structure for table GlobalConfiguration
-- ----------------------------
ALTER TABLE [dbo].[GlobalConfiguration] ADD CONSTRAINT [PK__GlobalCo__3214EC0780A437B5] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for Project
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[Project]', RESEED, 78)
GO


-- ----------------------------
-- Primary Key structure for table Project
-- ----------------------------
ALTER TABLE [dbo].[Project] ADD CONSTRAINT [PK__Project__3214EC07460CCCF6] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for Route
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[Route]', RESEED, 152)
GO


-- ----------------------------
-- Primary Key structure for table Route
-- ----------------------------
ALTER TABLE [dbo].[Route] ADD CONSTRAINT [PK__Route__3214EC07D45E5C92] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for RouteHostPort
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[RouteHostPort]', RESEED, 112)
GO


-- ----------------------------
-- Primary Key structure for table RouteHostPort
-- ----------------------------
ALTER TABLE [dbo].[RouteHostPort] ADD CONSTRAINT [PK__RouteHos__3214EC07F70F708C] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for RouteProperty
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[RouteProperty]', RESEED, 1)
GO


-- ----------------------------
-- Primary Key structure for table RouteProperty
-- ----------------------------
ALTER TABLE [dbo].[RouteProperty] ADD CONSTRAINT [PK__RoutePro__3214EC079C16F576] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Auto increment value for SettingBak
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[SettingBak]', RESEED, 47)
GO


-- ----------------------------
-- Primary Key structure for table SettingBak
-- ----------------------------
ALTER TABLE [dbo].[SettingBak] ADD CONSTRAINT [PK__Bak__3214EC07834029D2] PRIMARY KEY CLUSTERED ([Id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Primary Key structure for table UserAccount
-- ----------------------------
ALTER TABLE [dbo].[UserAccount] ADD CONSTRAINT [PK__UserAcco__3214EC27223F0A4E] PRIMARY KEY CLUSTERED ([ID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)  
ON [PRIMARY]
GO


-- ----------------------------
-- Foreign Keys structure for table DictionaryItem
-- ----------------------------
ALTER TABLE [dbo].[DictionaryItem] ADD CONSTRAINT [idx_dic_dicItem] FOREIGN KEY ([DictionaryId]) REFERENCES [dbo].[Dictionary] ([Id]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO


-- ----------------------------
-- Foreign Keys structure for table RouteHostPort
-- ----------------------------
ALTER TABLE [dbo].[RouteHostPort] ADD CONSTRAINT [idx_route_routehostport_routeId] FOREIGN KEY ([RouteId]) REFERENCES [dbo].[Route] ([Id]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO


-- ----------------------------
-- Foreign Keys structure for table RouteProperty
-- ----------------------------
ALTER TABLE [dbo].[RouteProperty] ADD CONSTRAINT [idx_route_routeproperty_routeId] FOREIGN KEY ([RouteId]) REFERENCES [dbo].[Route] ([Id]) ON DELETE NO ACTION ON UPDATE NO ACTION
GO

